package com.hspedu.newData.dmsxl.数组.二分查找;
/**
 * @Author: yh
 * @description: 
 * @CreateTime: 2025-05-07 
 * @Version: 1.0
 */

public class LC374猜数字大小 {

    public int guessNumber(int n) {

        int i = 1;
        while(i<n){
            int mid = i + (n-i)/2;
            int guess = guess(mid);
            if (guess < 0){
                n = mid - 1;
            }else if (guess > 0){
                i = mid + 1;
            }else {
                return mid;
            }
        }
        return i;
    }

    public int guess(int mid){

        return 1;
    }
}
